home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-08-27 | 15.0 KB | 310 lines | [TEXT/MPS ] |
- IMPORT TSDRVRPrime
- IMPORT TSDRVROpen
- IMPORT TSDRVRControl
- IMPORT TSDRVRStatus
- IMPORT TSDRVRClose
-
- * From SysEqu.a we get jIODone defined.
- * From Traps.a we get _Debugger defined.
- * From DriverGlue.incl.a we get the DbgInfo macro defined. It was just taken from
- * Sample.a and all the other macros were deleted.
- PRINT PUSH,OFF ; don't print any of this stuff
- INCLUDE 'SysEqu.a'
- INCLUDE 'Traps.a'
- INCLUDE 'DriverGlue.incl.a' ; all our macros and data templates
- PRINT POP ; restore the PRINT options
-
- *********************************** Main ********************************************
- * We have to make this the first entry point in our application because the DRVR *
- * header information must come first. So, we just put our data defines inside the *
- * "MAIN" procedure and then declare that as our entry point for Mr. Linker. *
- * The bits in the HIGH byte (beware of this -- it bit me the first go-around because*
- * I forgot to put them in the HIGH byte), are defined for this DRVR as follows: *
- * Bit 7 (most significant bit) Undefined False (0) *
- * Bit 6 dNeedLock True (1) *
- * Bit 5 dNeedTime False (0) *
- * Bit 4 dNeedGoodBye True (1) *
- * Bit 3 dStatEnable True (1) *
- * Bit 2 dCtlEnable True (1) *
- * Bit 1 dWritEnable True (1) *
- * Bit 0 (least significant bit) dReadEnable True (1) *
- * Which all adds up to: $5F.
- * I chose NOT to get periodic time because I really had nothing to do every five *
- * seconds, but I did choose the good-bye kiss because I wanted to be notified when *
- * I was going away. I don't do anything with it now, but it serves as an example *
- *************************************************************************************
-
- HEADERDEF PROC EXPORT
- IMPORT TSEPrime
- IMPORT TSEOpen
- IMPORT TSEControl
- IMPORT TSEStatus
- IMPORT TSEClose
- TSEStartHdr DC.W $5F00 ; Turn the proper bits on
- ; dNeedLock<6>, dNeedGoodbye<4)
- ; dReadEnable<3>, dWritEnable<2>
- ; dCtlEnable<1>, dStatEnable<0>
- DC.W $12C ; 5 seconds of delay (if dNeedTime = True)
- DC.W 0 ; DRVREMask (for DAs only)
- DC.W 0 ; DRVRMenu (for DAs only)
- DC.W TSEOpen-TSEStartHdr ; Offset to open routine
- DC.W TSEPrime-TSEStartHdr ; Offset to prime routine
- DC.W TSEControl-TSEStartHdr ; Offset to control routine
- DC.W TSEStatus-TSEStartHdr ; Offset to Status routine.
- DC.W TSEClose-TSEStartHdr ; Offset to Close routine.
- DC.B '.TimDriver' ; Driver name.
- ALIGN 4 ; Align to next long word.
- ENDP
-
- *********************************** TSEOpen ******************************************
- * This routine (and all like it below) performs three basic functions: *
- * 1) pushing the parameter block (A0), and the pointer to the DCE (A1) on the stack.*
- * 2) Testing to see whether the immediate bit was set in the trap word and RTSing *
- * 3) Testing the result in D0. If it's 1 the operation hasn't completed yet, so we *
- * just want to RTS. If it's NOT 1, then we'll jump through jIODone. *
- * I put the standard procedure header in just so you'd see another example of it in *
- * use. I found Sample.a to be most helpful in much of what I did here. *
- *************************************************************************************
- TSEOpen PROC EXPORT ; any source file can use this routine
-
- StackFrame RECORD {A6Link},DECR ; build a stack frame record
- Result1 DS.W 1 ; function's result returned to caller
- ParamBegin EQU * ; start parameters after this point
- ParamSize EQU ParamBegin-* ; size of all the passed parameters
- RetAddr DS.L 1 ; place holder for return address
- A6Link DS.L 1 ; place holder for A6 link
- LocalSize EQU * ; size of all the local variables
- ENDR
-
- WITH StackFrame ; cover our local stack frame
- LINK A6,#LocalSize ; allocate our local stack frame
-
-
- MOVEM.L D1-D3/A0-A4,-(A7) ;Save registers (V1.1A)
- MOVE.L A1,-(A7) ;Put address of DCE onto stack
- MOVE.L A0,-(A7) ;Put address of ParamBlock onto stack
- JSR TSDRVROpen ;Call our routine.
- ADDQ.W #$8,A7 ;Take off A0 and A1 we pushed.
- ADDA.L #ParamSize,SP ;strip all of the caller's parameters
- MOVEM.L (A7)+,D1-D3/A0-A4 ;Restore registers (V1.1A)
- SWAP D0 ;Save result in MostSig Word
- MOVE.W ioTrap(A0),D0 ;move ioTrap into register so we can test
- SWAP D0 ;Back again
- BTST #(noQueueBit+16), D0 ;Test the bit.
- BNE.S OpenRTS ;If Z = 0, then noQueueBit set -- branch
-
- CMP.W #$1,D0 ;Compare result with 1
- BEQ.S OpenRTS ;Not equal to zero so RTS.
- UNLK A6 ;destroy the link
- MOVE.L jIODone,-(A7) ;Put jIODone on the stack
- RTS ;return to the caller
-
- OpenRTS UNLK A6 ;destroy the link
- RTS ;return to the caller
- DbgInfo TSEOpen ;this name will appear in the debugger
- ENDP
-
-
- *********************************** TSEPrime *****************************************
- * This routine (and all like it below) performs three basic functions: *
- * 1) pushing the parameter block (A0), and the pointer to the DCE (A1) on the stack.*
- * 2) Testing to see whether the immediate bit was set in the trap word and RTSing *
- * 3) Testing the result in D0. If it's 1 the operation hasn't completed yet, so we *
- * just want to RTS. If it's NOT 1, then we'll jump through jIODone. *
- * I put the standard procedure header in just so you'd see another example of it in *
- * use. I found Sample.a to be most helpful in much of what I did here. *
- *************************************************************************************
- TSEPrime PROC EXPORT ; any source file can use this routine
-
- StackFrame RECORD {A6Link},DECR ; build a stack frame record
- Result1 DS.W 1 ; function's result returned to caller
- ParamBegin EQU * ; start parameters after this point
- ParamSize EQU ParamBegin-* ; size of all the passed parameters
- RetAddr DS.L 1 ; place holder for return address
- A6Link DS.L 1 ; place holder for A6 link
- LocalSize EQU * ; size of all the local variables
- ENDR
-
- WITH StackFrame ; cover our local stack frame
- LINK A6,#LocalSize ; allocate our local stack frame
-
-
- MOVEM.L D1-D3/A0-A4,-(A7) ;Save registers (V1.1A)
- MOVE.L A1,-(A7) ;Put address of DCE onto stack
- MOVE.L A0,-(A7) ;Put address of ParamBlock onto stack
- JSR TSDRVRPrime ;Call our routine.
- ADDQ.W #$8,A7 ;Take off A0 and A1 we pushed.
- ADDA.L #ParamSize,SP ;strip all of the caller's parameters
- MOVEM.L (A7)+,D1-D3/A0-A4 ;Restore registers (V1.1A)
- SWAP D0 ;Save result in MostSig Word
- MOVE.W ioTrap(A0),D0 ;move ioTrap into register so we can test
- SWAP D0 ;Back again
- BTST #(noQueueBit+16), D0 ;Test the bit.
- BNE.S PrimeRTS ;If Z = 0, then noQueueBit set -- branch
-
- CMP.W #$1,D0 ;Compare result with 1
- BEQ.S PrimeRTS ;Not equal to zero so RTS.
- UNLK A6 ;destroy the link
- MOVE.L jIODone,-(A7) ;Put jIODone on the stack
- RTS ;return to the caller
-
- PrimeRTS UNLK A6 ;destroy the link
- RTS ;return to the caller
- DbgInfo TSEPrime ;this name will appear in the debugger
- ENDP
-
-
-
-
- *********************************** TSEControl ***************************************
- * This routine (and all like it below) performs three basic functions: *
- * 1) pushing the parameter block (A0), and the pointer to the DCE (A1) on the stack.*
- * 2) Testing to see whether the immediate bit was set in the trap word and RTSing *
- * 3) Testing the result in D0. If it's 1 the operation hasn't completed yet, so we *
- * just want to RTS. If it's NOT 1, then we'll jump through jIODone. *
- * I put the standard procedure header in just so you'd see another example of it in *
- * use. I found Sample.a to be most helpful in much of what I did here. *
- *************************************************************************************
- TSEControl PROC EXPORT ; any source file can use this routine
-
- StackFrame RECORD {A6Link},DECR ; build a stack frame record
- Result1 DS.W 1 ; function's result returned to caller
- ParamBegin EQU * ; start parameters after this point
- ParamSize EQU ParamBegin-* ; size of all the passed parameters
- RetAddr DS.L 1 ; place holder for return address
- A6Link DS.L 1 ; place holder for A6 link
- LocalSize EQU * ; size of all the local variables
- ENDR
-
- WITH StackFrame ; cover our local stack frame
- LINK A6,#LocalSize ; allocate our local stack frame
-
- _Debugger
- MOVEM.L D1-D3/A0-A4,-(A7) ;Save registers (V1.1A)
- MOVE.L A1,-(A7) ;Put address of DCE onto stack
- MOVE.L A0,-(A7) ;Put address of ParamBlock onto stack
- JSR TSDRVRControl ;Call our routine.
- ADDQ.W #$8,A7 ;Take off A0 and A1 we pushed.
- ADDA.L #ParamSize,SP ;strip all of the caller's parameters
- MOVEM.L (A7)+,D1-D3/A0-A4 ;Restore registers (V1.1A)
- SWAP D0 ;Save result in MostSig Word
- MOVE.W ioTrap(A0),D0 ;move ioTrap into register so we can test
- SWAP D0 ;Back again
- BTST #(noQueueBit+16), D0 ;Test the bit.
- BNE.S ControlRTS ;If Z = 0, then noQueueBit set -- branch
-
- CMP.W #$1,D0 ;Compare result with 1
- BEQ.S ControlRTS ;Not equal to zero so RTS.
- UNLK A6 ;destroy the link
- MOVE.L jIODone,-(A7) ;Put jIODone on the stack
- RTS ;return to the caller
-
- ControlRTS UNLK A6 ;destroy the link
- RTS ;return to the caller
- DbgInfo TSEControl ;this name will appear in the debugger
- ENDP
-
-
-
-
- *********************************** TSEStatus ****************************************
- * This routine (and all like it below) performs three basic functions: *
- * 1) pushing the parameter block (A0), and the pointer to the DCE (A1) on the stack.*
- * 2) Testing to see whether the immediate bit was set in the trap word and RTSing *
- * 3) Testing the result in D0. If it's 1 the operation hasn't completed yet, so we *
- * just want to RTS. If it's NOT 1, then we'll jump through jIODone. *
- * I put the standard procedure header in just so you'd see another example of it in *
- * use. I found Sample.a to be most helpful in much of what I did here. *
- *************************************************************************************
- TSEStatus PROC EXPORT ; any source file can use this routine
-
- StackFrame RECORD {A6Link},DECR ; build a stack frame record
- Result1 DS.W 1 ; function's result returned to caller
- ParamBegin EQU * ; start parameters after this point
- ParamSize EQU ParamBegin-* ; size of all the passed parameters
- RetAddr DS.L 1 ; place holder for return address
- A6Link DS.L 1 ; place holder for A6 link
- LocalSize EQU * ; size of all the local variables
- ENDR
-
- WITH StackFrame ; cover our local stack frame
- LINK A6,#LocalSize ; allocate our local stack frame
-
-
- MOVEM.L D1-D3/A0-A4,-(A7) ;Save registers (V1.1A)
- MOVE.L A1,-(A7) ;Put address of DCE onto stack
- MOVE.L A0,-(A7) ;Put address of ParamBlock onto stack
- JSR TSDRVRStatus ;Call our routine.
- ADDQ.W #$8,A7 ;Take off A0 and A1 we pushed.
- ADDA.L #ParamSize,SP ;strip all of the caller's parameters
- MOVEM.L (A7)+,D1-D3/A0-A4 ;Restore registers (V1.1A)
- SWAP D0 ;Save result in MostSig Word
- MOVE.W ioTrap(A0),D0 ;move ioTrap into register so we can test
- SWAP D0 ;Back again
- BTST #(noQueueBit+16), D0 ;Test the bit.
- BNE.S StatusRTS ;If Z = 0, then noQueueBit set -- branch
-
- CMP.W #$1,D0 ;Compare result with 1
- BEQ.S StatusRTS ;Not equal to zero so RTS.
- UNLK A6 ;destroy the link
- MOVE.L jIODone,-(A7) ;Put jIODone on the stack
- RTS ;return to the caller
-
- StatusRTS UNLK A6 ;destroy the link
- RTS ;return to the caller
- DbgInfo TSEStatus ;this name will appear in the debugger
- ENDP
-
-
-
-
- *********************************** TSEClose *****************************************
- * This routine (and all like it below) performs three basic functions: *
- * 1) pushing the parameter block (A0), and the pointer to the DCE (A1) on the stack.*
- * 2) Testing to see whether the immediate bit was set in the trap word and RTSing *
- * 3) Testing the result in D0. If it's 1 the operation hasn't completed yet, so we *
- * just want to RTS. If it's NOT 1, then we'll jump through jIODone. *
- * I put the standard procedure header in just so you'd see another example of it in *
- * use. I found Sample.a to be most helpful in much of what I did here. *
- *************************************************************************************
- TSEClose PROC EXPORT ; any source file can use this routine
-
- StackFrame RECORD {A6Link},DECR ; build a stack frame record
- Result1 DS.W 1 ; function's result returned to caller
- ParamBegin EQU * ; start parameters after this point
- ParamSize EQU ParamBegin-* ; size of all the passed parameters
- RetAddr DS.L 1 ; place holder for return address
- A6Link DS.L 1 ; place holder for A6 link
- LocalSize EQU * ; size of all the local variables
- ENDR
-
- WITH StackFrame ; cover our local stack frame
- LINK A6,#LocalSize ; allocate our local stack frame
-
-
- _Debugger
- MOVEM.L D1-D3/A0-A4,-(A7) ;Save registers (V1.1A)
- MOVE.L A1,-(A7) ;Put address of DCE onto stack
- MOVE.L A0,-(A7) ;Put address of ParamBlock onto stack
- JSR TSDRVRClose ;Call our routine.
- ADDQ.W #$8,A7 ;Take off A0 and A1 we pushed.
- ADDA.L #ParamSize,SP ;strip all of the caller's parameters
- MOVEM.L (A7)+,D1-D3/A0-A4 ;Restore registers (V1.1A)
- SWAP D0 ;Save result in MostSig Word
- MOVE.W ioTrap(A0),D0 ;move ioTrap into register so we can test
- SWAP D0 ;Back again
- BTST #(noQueueBit+16), D0 ;Test the bit.
- BNE.S CloseRTS ;If Z = 0, then noQueueBit set -- branch
-
- CMP.W #$1,D0 ;Compare result with 1
- BEQ.S CloseRTS ;Not equal to zero so RTS.
- UNLK A6 ;destroy the link
- MOVE.L jIODone,-(A7) ;Put jIODone on the stack
- RTS ;return to the caller
-
- CloseRTS UNLK A6 ;destroy the link
- RTS ;return to the caller
- DbgInfo TSEClose ;this name will appear in the debugger
- ENDP
-
- END